package com.itheima.tlias.controller;

import com.itheima.tlias.pojo.JobDateOption;
import com.itheima.tlias.pojo.Result;
import com.itheima.tlias.pojo.StudentDateOption;
import com.itheima.tlias.service.EmpService;
import com.itheima.tlias.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/report")
public class StaticController {

	@Autowired
	private EmpService empService;

	@Autowired
	private StudentService studentService;

	@GetMapping("/empJobData")
	public Result getJobData() {
		JobDateOption jobDateOption = empService.getJobData();
		return Result.success(jobDateOption);
	}

	@GetMapping("/empGenderData")
	public Result getGenderData() {
		List<Map<String, Object>> list = empService.getGenderData();
		return Result.success(list);
	}

	@GetMapping("/studentDegreeData")
	public Result getStudentDegreeData() {
		List<Map<String, Object>> list = studentService.getDegreeData();
		return Result.success(list);
	}

	@GetMapping("/studentCountData")
	public Result getStudentCountData() {
		StudentDateOption studentCountData = studentService.getStudentCountData();
		return Result.success(studentCountData);
	}
}
